/**
 * Created by peiqiangqiang on 2017/6/2.
 */
export const options1 = [{
		value:'1',
		label:'广告系列'
	},{
		value:'2',
		label:'广告组'
	},{
		value:'3',
		label:'广告'
}];


export const options3 = [{
      value: 'LIFETIME',
      label: '广告发布时间'
    }, {
      value: 'LAST_7_DAYS',
      label: '近七天',
    }, {
      value: 'LAST_14_DAYS',
      label: '近十四天'
    }, {
      value: 'LAST_30_DAYS',
      label: '近三十天'
    }, {
      value: 'THIS_MONTH',
      label: '本月'
    }, {
      value: 'LAST_WEEK',
      label: '上周'
    }, {
      value: '',
      label: '自定义时间'
}];

export const options3Google = [{
      value: 'LAST_7_DAYS',
      label: '近七天',
    }, {
      value: 'LAST_14_DAYS',
      label: '近十四天'
    }, {
      value: 'LAST_30_DAYS',
      label: '近三十天'
    }, {
      value: 'THIS_MONTH',
      label: '本月'
    }, {
      value: 'LAST_WEEK',
      label: '上周'
    }, {
      value: '',
      label: '自定义时间'
}];


export const options4 = [{
    	value:'1',
    	label:'按覆盖数'
    },{
    	value:'2',
    	label:'按展示数'
    },{
    	value:'3',
    	label:'按成效'
    },{
    	value:'4',
    	label:'按花费'
    },{
    	value:'5',
    	label:'按成效转化率'
}];


export const options4Google = [{
    	value:'1',
    	label:'按展示数'
    },{
    	value:'2',
    	label:'按点击'
    },{
    	value:'3',
    	label:'按点击率'
    },{
    	value:'4',
    	label:'按花费'
}];


export const searchbtn = [{
    	name:'位置',
    	value:'0',
    	isactive:true
    },{
    	name:'年龄',
    	value:'1',
    	isactive:false
    },{
    	name:'性别',
    	value:'2',
    	isactive:false
    },{
    	name:'展示设备',
    	value:'3',
    	isactive:false
}];


export const searchbtnGoogle = [{
    	name:'位置',
    	value:'0',
    	isactive:true
    },{
    	name:'展示设备',
    	value:'1',
    	isactive:false
}];


export const charts1 = {
	chart: {
		width:658,
		height:438,
        type: 'line'
    },
	title: {
	    text: null
	},
    xAxis: {
        categories: [],
		tickmarkPlacement: 'on',
        lineWidth: 0
    },
    yAxis:{
	   title:{
	       text:null
	   }
	},
	tooltip: {
		shared:true,
		backgroundColor: '#5c5c5c',
		borderColor:'#5c5c5c',
		style:{
			color:'#fff'
		},
		headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
        pointFormat: '<tr><td style="backgoundColor:#fff;padding:0">{series.name}: </td>' +
        '<td style="padding:0"><b>{point.y}</b></td></tr>',
        footerFormat: '</table>',
        useHTML: true
    },
	credits:{
		enabled:false
	},
    legend: {
    	verticalAlign:'top',
    	itemMarginTop:0,
        align:'right',
        borderWidth: 0
    },
    series: []
};


export const charts1Google = {
    	chart: {
    		width:658,
    		height:438,
            type: 'line'
        },
    	title: {
		    text: null
		},
	    xAxis: {
	        categories: [],
            lineWidth: 0
	    },
	    yAxis:[{ // 第一条Y轴
		      title: {
		         text: '花费',
		      },
			  opposite: true,
			  min:0
		   }, { // 第二条Y轴
		      title: {
		         text: '点击',
		      },
		      min:0
		   }, { // 第三条Y轴
		      gridLineWidth: 0,
		      title: {
		         text: '展示数',
		      },
		      opposite:true,
		      min:0
		   }],
		tooltip: {
			shared:true,
			backgroundColor: '#5c5c5c',
			borderColor:'#5c5c5c',
			style:{
				color:'#fff'
			},
			headerFormat: null,
            pointFormat:'<span style="backgoundColor:#fff">{series.name}:{point.y}<br/></span>'
        },
		credits:{
			enabled:false
		},
	    legend: {
	    	verticalAlign:'bottom',
	    	itemMarginTop:0,
	        align:'center',
	        borderWidth: 0,
	        itemHoverStyle:{
	        	cursor:'default'
	        }
	    },
	    plotOptions: {
	    	series:{
				events:{
					legendItemClick:function(event){
						return false
					}
				}
	    		
	    	}
	    },
	    series: []
};


export const charts2 = {
	chart: {
		width:436,
        type: 'column'
    },
	title: {
	    text: '最好的时期',
	    align:'left',
	    style:{
	    	fontSize:'14px'
	    }
	},
    xAxis: {
        categories: [],
    },
    yAxis:{
	   title:{
	       text:null
	   }
	},
	tooltip: {
		backgroundColor: '#5c5c5c',
		borderColor:'#5c5c5c',
		style:{
			color:'#fff'
		},
		headerFormat: null,
        shared: true,
        pointFormat:'<span style="backgoundColor:#fff">{series.name}:{point.y}<br/></span>'
    },
    plotOptions: {
        column: {
            maxPointWidth: 40
        }
    },
	credits:{
		enabled:false
	},
    legend: {
    	labelFormat: '{name}',
    	verticalAlign:'top',
    	itemMarginTop:0,
        align:'right',
        borderWidth: 0
    },
    series: []
};

export const charts3 = {
	chart: {
		width:638,
		height:375,
        type: 'column'
    },
    title: {
        text: null
    },
    credits:{
		enabled:false
	},
	legend:{
		enabled:false
	},
    xAxis: {
        categories: []
    },
    yAxis: {
    	labels: {
         	format: ''
       },
    	//max:'',
        allowDecimals: true,//控制显示数据是否为小数
        min: 0,
        title: {
            text: null
        }
    },
    tooltip: {
    	backgroundColor: '#5c5c5c',
		borderColor:'#5c5c5c',
		style:{
			color:'#f1f1f1'
		},
    	headerFormat: null,
    	shared: true,
    	valueSuffix: ''
        
    },
    plotOptions: {
        column: {
            stacking: 'normal',
            maxPointWidth: 40
        }
    },
    series: []
};

export const charts4 = {
	chart: {
		width:437,
		height:375,
		type: 'pie'
    },
    title: {
        text: null,
		align:'left'			            
    },
    credits:{
		enabled:false
	},
    tooltip: {
    	enabled:false,
    },
    plotOptions: {
        pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
            	distance:10,
                enabled:true,
                format: '<b>{point.name}</b><br/> {point.percentage:.1f} %',
                style:{
                	color:''
                }
            },
            showInLegend: true
        }
    },
    colors:[
    	'#5fd863','#9167f8','#fe3834','#79cffb','#2a80f2'
    ],
    series: [
    	{
    		data:[]
    	}
    ]
};

//交换数组位置
export const temp = (arr,i,j) => {
	var temp=arr[i]
	arr[i] = arr[j];
	arr[j] = temp;
	return arr;
};

//判断对象是否为空
export const check = (obj) => {
	if (typeof obj === "object" && !(obj instanceof Array)){  
        var hasProp = false;  
        for (var prop in obj){  
            hasProp = true;  
            break;  
        }  
    }
    return hasProp;
};

//将数据分组的函数
export const group = (array, subGroupLength) => {
	var index = 0;
    var newArray = [];
    while(index < array.length) {
        newArray.push(array.slice(index, index += subGroupLength));
    }
    return newArray;
};

//转化时间戳1
export const formatDate1 = (now) => {
	var year=now.getFullYear();
  	var month=now.getMonth()+1;     
  	var date=now.getDate();  
  	return year+"/"+month+"/"+date
};

//转化时间戳2
export const formatDate2 = (now) => {
	var month=now.getMonth()+1;     
  	var date=now.getDate();  
  	return month+"/"+date
};


